package com.gml.design.other.strategy;

import java.util.Arrays;

/**
 * @ClassName : Main
 * @Description :
 * @Author : gml
 * @Date: 2021-04-02 16:42
 */
public class Main {

    public static void main(String[] args) {
        Cat[] cats = new Cat[]{new Cat(1, 3), new Cat(5, 2), new Cat(3,5)};

        Sorter.sort(cats);

        System.out.println(Arrays.toString(cats));

        //策略排序

        StrategySorter<Cat> strategySorter = new StrategySorter<>();
        strategySorter.sort(cats, new WidthComparator());
        System.out.println(Arrays.toString(cats));

        strategySorter.sort(cats, new HighComparator());
        System.out.println(Arrays.toString(cats));
    }

}
